package function;

import java.sql.Connection;
import java.sql.PreparedStatement;

import DBController.DBConMan;

public class RunQuery 
{
	private Connection con;
	private String query;
	
	public boolean CreateSequence()
	{
		PreparedStatement pstmt=null;
		try 
		{
			con= DBConMan.dBConn();
			pstmt = con.prepareStatement(query);
			pstmt.executeUpdate(query);
			return true;
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			return false;
		}
		finally
		{
			try
			{
				if(pstmt!=null)
					pstmt.close();
				if(con!=null)
					con.close();
			}
			catch(Exception ea)
			{}

				
		}
	}
	
	public boolean CreateTable()
	{
		PreparedStatement pstmt=null;
		try 
		{
			con= DBConMan.dBConn();
			pstmt = con.prepareStatement(query);
			pstmt.executeUpdate(query);
			return true;
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			return false;
		}
		finally
		{
			try
			{
				if(pstmt!=null)
					pstmt.close();
				if(con!=null)
					con.close();
			}
			catch(Exception ea)
			{}

				
		}
	}
	public String[] getTables()
	{
		
		return null;
	}
	public void setQuery(String query) {
		this.query = query;
	}
}

